package bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

//学生作业信息，一次git远程仓库作业为一次作业，含有多次版本
public class StudentJob{
    private int jobId;//作业序号
    private int jobNumber;//作业次序
    //@ExcelProperty(index=7)
    private String studentId;//学号
    //@ExcelProperty(index=6)
    private String name;//姓名
   // @ExcelProperty(index=1,format = "yyyy/MM/dd h:m:s")
    private Date jobDate;//作业提交时间
    //@ExcelProperty(index=8)
    private String jobGitAddress;//git仓库地址
    private List<GitVersionInfo> gitVersionInfos;//作业多次版本信息集合

    public StudentJob() {
        this.gitVersionInfos=new ArrayList<GitVersionInfo>();
    }

    public StudentJob(int jobId,String id, String name, String jobGitAddress) {
        this.jobId=jobId;
        this.studentId = id;
        this.name = name;
        this.jobGitAddress = jobGitAddress;
        this.gitVersionInfos=new ArrayList<GitVersionInfo>();
    }

    public Date getJobDate() {
        return jobDate;
    }

    public void setJobDate(Date jobDate) {
        this.jobDate = jobDate;
    }

    public int getJobNumber() {
        return jobNumber;
    }

    public int getJobId() {
        return jobId;
    }

    public void setJobId(int jobId) {
        this.jobId = jobId;
    }

    public void setJobNumber(int jobNumber) {
        this.jobNumber = jobNumber;
    }

    public String getStudentId() {
        return studentId;
    }

    public void setStudentId(String studentId) {
        this.studentId = studentId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getJobGitAddress() {
        return jobGitAddress;
    }

    public void setJobGitAddress(String jobGitAddress) {
        this.jobGitAddress = jobGitAddress;
    }

    public List<GitVersionInfo> getGitVersionInfos() {
        return gitVersionInfos;
    }

    public void addGitVersionInfos(GitVersionInfo gitVersionInfo) {
        this.gitVersionInfos.add(gitVersionInfo);//增加一次版本信息
    }



    public String toString(){
        StringBuffer sb=new StringBuffer();
        sb.append("学号："+studentId+"；姓名："+name+"；本次作业git地址："+jobGitAddress+"。\n");
        for(GitVersionInfo gitVersionInfo:this.gitVersionInfos){
            sb.append("提交人："+gitVersionInfo.getName()+"。提交时间："+gitVersionInfo.getDate().toString()+"。版本号："+gitVersionInfo.getVersion()+"。\n");
        }
        return sb.toString();
    }
}
